const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');


module.exports = {
    entry: './src/main.js',
    module: {
        rules: [
            {
                test: /\.css$/,
                use:  [
                    'vue-style-loader',
                    'style-loader',
                    'css-loader',

                ]
            },
            {
                test: /\.less$/,
                use:  [

                    'style-loader',
                    'css-loader',
                    'less-loader',

                ]
            },
            {
                test: /\.vue$/,
                use: 'vue-loader'
            },
            {
                test: /\.js$/,
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            presets: ['@babel/preset-env']
                        }
                    }
                ]
            },
            {
                test: /\.jpg|png|gif|bmp|ttf|eot|svg|woff|woff2$/,
                use: [{
                    loader: 'url-loader',
                    options: {
                        esModule: false,
                        limit: 10 * 1024,
                    }
                }]
            },
            {
                test: /\.(js|vue)$/,
                include: [__dirname + '/src'],
                exclude: /node_modules/,
                use: 'eslint-loader',
                enforce: 'pre',
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: 'index',
            template: './src/index.html',
        }),
        new VueLoaderPlugin()

    ],
    output: {
        filename: '[name].[chunkhash:8]].js',
        path: path.join(__dirname, 'dist'),
    },
}